<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>回执结算管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/ap/recel/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            $('#date').datetimepicker({
                format: "YYYY-MM-DD "
            });
            $('#jsdate').datetimepicker({
                format: "YYYY-MM-DD "
            });
		});
        function js() {
            var hd=$("#sfhd").val();
            var xj=$("#money").val();
            var yk=$("#oil").val();
            if(xj==""){
                xj="0";
            }
            if(yk==""){
                yk="0";
            }
            if(hd==""){
                hd="0";
            }
            $("#sfzje").val(parseFloat(xj)+parseFloat(yk)+parseFloat(hd));
        }
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="recel" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
			<input type="hidden" name="status" value="${recel.status}"/>
		   <tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>签订时间：</label></td>
					<td class="width-35">
						<div class='input-group form_datetime' id='date'>
							<input type='text'  name="date" class="form-control required"  value="<fmt:formatDate value="${recel.date}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>

					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>合同号：</label></td>
					<td class="width-35">
						<form:input path="code" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">无车承运单号：</label></td>
					<td class="width-35">
						<form:input path="zccode" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>租车协议金额：</label></td>
					<td class="width-35">
						<form:input path="zcje" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">承运人：</label></td>
					<td class="width-35">
						<form:input path="person" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">车牌号：</label></td>
					<td class="width-35">
						<form:input path="card" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">司机电话：</label></td>
					<td class="width-35">
						<form:input path="phone" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>起运地：</label></td>
					<td class="width-35">
						<form:input path="start" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>到站地：</label></td>
					<td class="width-35">
						<form:input path="arrive" htmlEscape="false"    class="form-control  required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>重量：</label></td>
					<td class="width-35">
						<form:input path="weight" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>数量：</label></td>
					<td class="width-35">
						<form:input path="num" htmlEscape="false"    class="form-control  required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>货到合同金额：</label></td>
					<td class="width-35">
						<form:input path="hdht" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>回执合同金额：</label></td>
					<td class="width-35">
						<form:input path="hzht" htmlEscape="false"    class="form-control  required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>回执协议金额：</label></td>
					<td class="width-35">
						<form:input path="hzxy" htmlEscape="false"    class="form-control  required"/>
					</td>
				</tr>
				<tr><td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>实付货到金额：</label></td>
					<td class="width-35">
						<form:input path="sfhd" htmlEscape="false"  onblur="js()"  class="form-control  required"/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>实付回执现金：</label></td>
					<td class="width-35">
						<form:input path="money" htmlEscape="false" onblur="js()"   class="form-control  required"/>
					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>实付回执油卡：</label></td>
					<td class="width-35">
						<form:input path="oil" htmlEscape="false" onblur="js()"   class="form-control  required"/>
					</td>
					<td class="width-15 active"><label class="pull-right">油卡卡号：</label></td>
					<td class="width-35">
						<form:input path="number" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">实付总金额：</label></td>
					<td class="width-35">
						<form:input path="sfzje" htmlEscape="false"  readonly="true"  class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>结算日期：</label></td>
					<td class="width-35">
						<div class='input-group form_datetime' id='jsdate'>
							<input type='text'  name="jsdate" class="form-control required"  value="<fmt:formatDate value="${recel.jsdate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>

					</td>

				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">领款人：</label></td>
					<td class="width-35">
						<form:input path="driver" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">回执单号：</label></td>
					<td class="width-35">
						<form:input path="receipt" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">项目：</label></td>
			   <td class="width-35">
				   <form:input path="pro" htmlEscape="false" readonly="true"   class="form-control "/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">增减说明：</label></td>
			   <td class="width-35" >
				   <form:input path="remarks" htmlEscape="false"    class="form-control "/>
			   </td>
		   </tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>